package com.meatball.core.validation

import jakarta.validation.ConstraintValidator
import jakarta.validation.ConstraintValidatorContext

/**
 * TODO 密码格式验证器
 *
 * @author 张翔宇
 * @since 2024年3月28日
 */
class PasswordValidator : ConstraintValidator<PasswordValidity, String> {
    override fun isValid(p0: String?, p1: ConstraintValidatorContext?): Boolean {
        p0?.let {
            val md5Pattern = Regex("^[a-fA-F0-9]{32}$")
            return md5Pattern.matches(it)
        }
        return false
    }
}